<template>
  <div>2.选你爱我求和
    <label v-for="(item,index) in num" :key="index">
      <input type="checkbox" :value="item" v-model="sum">{{item}}
    </label> 
    <p>选中的数字的总和为：{{getsum}}</p>
  </div>
</template>
 
<script>
export default {
  data() {
    return {
      num: [9, 15, 19, 25, 29, 31, 48, 57, 62, 79, 87],
      sum: [],
    }
  },
  computed: {
    getsum() {
      return this.sum.reduce((prev,item) => item += prev,0)
    }
  },
  methods: {},
  components: {},
};
</script>

<style scoped>
     
</style>